package com.fz.controller.system;

import com.fz.common.ResponseEntity;
import com.fz.beans.PageBeans;
import com.fz.dto.system.log.LoginLogDto;
import com.fz.dto.system.log.LogDto;
import com.fz.entity.log.*;
import com.fz.service.system.LogService;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@Api(value = "日志管理", tags = "日志管理")
@RequestMapping("/log")
@ApiSort(value = 10)
@CrossOrigin
@SuppressWarnings("unchecked")
public class LogController {

    @Resource
    private LogService logService;

    @GetMapping("/findSysLoginLogList")
    @ApiOperation(value = "查询运营平台登录日志列表")
    @ApiOperationSupport(order = 1)
    public ResponseEntity<SysLoginLog> findSysLoginLogList(LoginLogDto loginLogDto, PageBeans pageBeans) throws Exception{
        return logService.findSysLoginLogList(loginLogDto,pageBeans.getPageSize(),pageBeans.getPageNum());
    }


    @GetMapping("/findSysOperLogList")
    @ApiOperation(value = "查询运营平台操作日志列表")
    @ApiOperationSupport(order = 2)
    public ResponseEntity<SysOperLog> findSysOperLogList(LogDto logDto,PageBeans pageBeans) throws Exception{
        return logService.findSysOperLogList(logDto,pageBeans.getPageSize(),pageBeans.getPageNum());
    }


    @GetMapping("/findSysErrorLogList")
    @ApiOperation(value = "查询运营平台异常日志列表")
    @ApiOperationSupport(order = 3)
    public ResponseEntity<SysErrorLog> findSysErrorLogList(LogDto logDto,PageBeans pageBeans) throws Exception{
        return logService.findSysErrorLogList(logDto,pageBeans.getPageSize(),pageBeans.getPageNum());
    }


    @GetMapping("/findClientOperLogList")
    @ApiOperation(value = "查询用户平台操作日志列表")
    @ApiOperationSupport(order = 4)
    public ResponseEntity<ClientOperLog> findClientOperLogList(LogDto logDto,PageBeans pageBeans) throws Exception{
        return logService.findClientOperLogList(logDto,pageBeans.getPageSize(),pageBeans.getPageNum());
    }

    @GetMapping("/findClientErrorLogList")
    @ApiOperation(value = "查询用户平台异常日志列表")
    @ApiOperationSupport(order = 5)
    public ResponseEntity<ClientErrorLog> findClientErrorLogList(LogDto logDto, PageBeans pageBeans) throws Exception{
        return logService.findClientErrorLogList(logDto,pageBeans.getPageSize(),pageBeans.getPageNum());
    }
}
